# Contributor: Dennis Krupenik <dennis@krupenik.com>
# Maintainer: Dennis Krupenik <dennis@krupenik.com>
pkgname=one-dnn
pkgver=1.5.1
pkgrel=0
pkgdesc="oneAPI Deep Neural Network Library"
url="https://01.org/oneDNN"
# Used to executed primitives on Intel 64bit, aarch64 and compatible devices
arch="x86_64 aarch64"
license="Apache-2.0"
depends_dev="libtbb-dev opencl-headers opencl-icd-loader-dev"
makedepends="cmake $depends_dev"
subpackages="$pkgname-dev $pkgname-doc"
source="https://github.com/oneapi-src/oneDNN/archive/v$pkgver/oneDNN-$pkgver.tar.gz"
builddir="$srcdir/oneDNN-$pkgver"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DCMAKE_BUILD_TYPE=None \
		-DDNNL_GPU_RUNTIME=OCL \
		$CMAKE_CROSSOPTS .
	make -C build
}

check() {
	ctest -E '(gpu|cross-engine)'
}

package() {
	make -C build DESTDIR="$pkgdir" install
}

sha512sums="d20c21834f7e82d8b567b16b218516ea14b77d55676c36604a17b53a18f0f4531feae348bd27e3485a2d81effd98d7f8f9fe7d8e48a44581b00d829c9c42b22d  oneDNN-1.5.1.tar.gz"
